#ifndef __SOCKET_H_
#define __SOCKET_H_



#include "Translate.h"

class DECLSPEC CSocket
{
public:
    /**
     * Send some message in this function
     * @param strMSG : The message that you want to send
     * @return ：Send result
     */
    virtual int Send(const std::string strMSG) = 0;

    /**
     * Recv some messaeg in this function
     * @param strMSG : Get message buffer
     * @return : Recv result
     */
    virtual int Recv(std::string &strMSG) = 0;

    /**
     * Get connecte host
     * @return : Connecte host string
     */
    std::string GetHost();

    /**
     * Get connecte port
     * @return : Connecte port 
     */
    int GetPort();

    /**
     * Reloading the type
     * Translate this object to socket type
     */
    operator SOCKET();

protected:
    CSocket();

public:
    ~CSocket();

protected:
    // The communicate identifier
    SOCKET m_nSocket_fd;

    // The communicate address
    struct sockaddr_in m_addrHost;
};

#endif // !__SOCKET_H_